package com.smartticket.jeju.controller.user;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.smartticket.jeju.model.Purchase;
import com.smartticket.jeju.service.PurchaseService;

@Controller
@RequestMapping("/profile")
public class Profile 
{
	@Autowired
	private PurchaseService purchaseService;
	
	@RequestMapping
	public ModelAndView action()
	{
		//세션에 유저 아이디가 있어야함
		//없으면 로그인페이지 가자 그냥 ㅋㅋ
		
		String user_id = "dongdang";
		
		ModelAndView modelAndView = new ModelAndView();
		
		List<Purchase> purchases = purchaseService.list(user_id);
		
		modelAndView.addObject("purchases", purchases);
		
		return modelAndView;
	}
}
